<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<header class="header style7">
    <div class="top-bar">
        <!--<div class="container">
            <div class="top-bar-left">
                <div class="header-message">
                    Welcome to SUSTAR GLOVE!
                </div>
            </div>
            <div class="top-bar-right">
                <div class="header-language">
                    <div class="herald-language herald-dropdown">
                        <a href="#" class="active language-toggle" data-herald="herald-dropdown">
								<span>
									English (USD)
								</span>
                        </a>
                        <ul class="herald-submenu">
                            <li class="switcher-option">
                                <a href="#">
										<span>
											French (EUR)
										</span>
                                </a>
                            </li>
                            <li class="switcher-option">
                                <a href="#">
										<span>
											Japanese (JPY)
										</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
                <ul class="header-user-links">
                    <li>
                        <a href="login.html">Login or Register</a>
                    </li>
                </ul>
            </div>
        </div>-->
        <!--分享的图片-->
        <div style="margin:0 auto;display:none;">
            <img src='assets/images/smalllogo.png' />
        </div>

    </div>
    <div class="container">
        <div class="main-header">
            <div class="row">
                <div class="col-lg-3 col-sm-4 col-md-3 col-xs-7 col-ts-12 header-element">
                    <div class="logo">
                        <a href="index.html">
                            <img src="assets/images/logo.png" alt="img" />
                        </a>
                    </div>
                </div>
                <div class="col-lg-7 col-sm-8 col-md-6 col-xs-5 col-ts-12">
                    <div class="block-search-block">
                        <form class="form-search form-search-width-category">
                            <div class="form-content">
                                <!--<div class="category">
                                    <select title="cate" data-placeholder="All Categories" class="chosen-select"
                                            tabindex="1">
                                        <option value="United States">Best Seller</option>
                                        <option value="United Kingdom">Creamy</option>
                                        <option value="Afghanistan">Citrus</option>
                                        <option value="Aland Islands">Spray Bottle</option>
                                        <option value="Albania">New Arrivals</option>
                                        <option value="Algeria">Sweet</option>
                                    </select>
                                </div>-->
                                <div class="inner">
                                    <input type="text" class="input" name="s" value="" placeholder="Search" />
                                </div>
                                <button class="btn-search" type="submit">
                                    <span class="icon-search"></span>
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="col-lg-2 col-sm-12 col-md-3 col-xs-12 col-ts-12">
                    <div class="header-control">
                        <div class="block-minicart herald-mini-cart block-header herald-dropdown">
                            <!--<a href="javascript:void(0);" class="shopcart-icon" data-herald="herald-dropdown">
                                Cart
                                <span class="count">
									0
									</span>
                            </a>-->
                            <div class="no-product herald-submenu">
                                <p class="text">
                                    You have
                                    <span>
											 0 item(s)
										</span>
                                    in your bag
                                </p>
                            </div>
                        </div>
                        <div class="block-account block-header herald-dropdown">
                                <a href="javascript:void(0);" data-herald="herald-dropdown">
                                    <span class="flaticon-user"></span>
                                </a>
                                <div style="float: right;" th:if=" ${session.user} != null"  data-herald="herald-dropdown">
                                    <text th:text="${session.user}"></text>
                                    <a href="#">Log out</a>
                                </div>
                                <div style="float: right;" th:if=" ${session.user} == null" th:text="Login" data-herald="herald-dropdown"></div>
                            <div class="header-account herald-submenu">
                                <div class="header-user-form-tabs">
                                    <ul class="tab-link">
                                        <li class="active">
                                            <a data-toggle="tab" aria-expanded="true" href="#header-tab-login">Login</a>
                                        </li>
                                        <li>
                                            <a data-toggle="tab" aria-expanded="true" href="#header-tab-rigister">Register</a>
                                        </li>
                                    </ul>
                                    <div class="tab-container">
                                        <div id="header-tab-login" class="tab-panel active">
                                            <form method="post" id="login-form" class="login form-login">
                                                <p class="form-row form-row-wide">
                                                    <input type="text" placeholder="Phone Number" name="username" class="input-text" />
                                                </p>
                                                <p class="form-row form-row-wide">
                                                    <input type="password" class="input-text" name="password" placeholder="Password" />
                                                </p>
                                                <p class="form-row">
                                                    <label class="form-checkbox">
                                                        <input type="checkbox" class="input-checkbox" />
                                                        <span>
																Remember me
															</span>
                                                    </label>
                                                    <input type="button" onclick="login()" class="button" value="Login" />
                                                </p>
                                                <p class="lost_password">
                                                    <a href="#">Forget password?</a>
                                                </p>
                                            </form>
                                        </div>
                                        <div id="header-tab-rigister" class="tab-panel">
                                            <form method="post" id="register-form" class="register form-register">
                                                <p class="form-row form-row-wide">
                                                    <input type="text" placeholder="Phone Number" name="phoneNumber" class="input-text" />
                                                </p>

                                                <p class="form-row form-row-wide">
                                                    <input type="text" placeholder="Your name" name="realName" class="input-text" />
                                                </p>
                                                <p class="form-row form-row-wide">
                                                    <input type="text" placeholder="Company name" name="companyName" class="input-text" />
                                                </p>

                                                <p class="form-row form-row-wide">
                                                    <input type="password" class="input-text" name="password" placeholder="passwrod" />
                                                </p>
                                                <p class="form-row">
                                                    <input type="button" onclick="register()" class="button" value="Register" />
                                                </p>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <a class="menu-bar mobile-navigation menu-toggle" href="#">
                            <span></span>
                            <span></span>
                            <span></span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="header-nav-container">
        <div class="container">
            <div class="header-nav-wapper main-menu-wapper">
                <div class="vertical-wapper block-nav-categori">
                    <div class="block-title">
						<span class="icon-bar">
							<span></span>
							<span></span>
							<span></span>
						</span>
                        <span class="text">Product List</span>
                    </div>
                    <div class="block-content verticalmenu-content">
                        <ul class="herald-nav-vertical vertical-menu herald-clone-mobile-menu">

                            <li class="menu-item">
                                <a title="Creamy" href="productlist.html?tag=allType" class="herald-menu-item-title">All</a>
                            </li>

                            <li class="menu-item menu-item-has-children">
                                <a title="Best Seller" href="productlist.html?tag=hotResistant_all" class="herald-menu-item-title">Heat Resistant Gloves</a>
                                <span class="toggle-submenu"></span>
                                <ul role="menu" class=" submenu">
                                    <li class="menu-item">
                                        <a title="Minty" href="productlist.html?tag=hotResistant_knit" class="herald-item-title">Seamless Knit</a>
                                    </li>
                                    <li class="menu-item">
                                        <a title="Creamy" href="productlist.html?tag=hotResistant_gumming" class="herald-item-title">Dipping Series</a>
                                    </li>
                                    <li class="menu-item">
                                        <a title="New Arrivals" href="productlist.html?tag=hotResistant_sew" class="herald-item-title">Cut-and-Sewn</a>
                                    </li>
                                    <li class="menu-item">
                                        <a title="Best Seller" href="productlist.html?tag=hotResistant_injection" class="herald-item-title">Molded Series</a>
                                    </li>
                                </ul>
                            </li>

                            <li class="menu-item menu-item-has-children">
                                <a title="Best Seller" href="productlist.html?tag=cutResistant_all" class="herald-menu-item-title">Cut Resistant Gloves</a>
                                <span class="toggle-submenu"></span>
                                <ul role="menu" class=" submenu">
                                    <li class="menu-item">
                                        <a title="Minty" href="productlist.html?tag=cutResistant_pure" class="herald-item-title">Uncoated Series</a>
                                    </li>
                                    <li class="menu-item">
                                        <a title="Creamy" href="productlist.html?tag=cutResistant_glue" class="herald-item-title">Coated Series</a>
                                    </li>
                                    <li class="menu-item">
                                        <a title="New Arrivals" href="productlist.html?tag=cutResistant_steel" class="herald-item-title">Steel Mesh</a>
                                    </li>
                                    <li class="menu-item">
                                        <a title="Best Seller" href="productlist.html?tag=cutResistant_sew" class="herald-item-title">Cut-and-Sewn</a>
                                    </li>
                                </ul>
                            </li>

                            <li class="menu-item">
                                <a title="Creamy" href="productlist.html?tag=hardWearing" class="herald-menu-item-title">Wear Resistant Gloves</a>
                            </li>
                            <li class="menu-item">
                                <a title="Fruity" href="productlist.html?tag=antiCollision" class="herald-menu-item-title">Impact Resistant Gloves</a>
                            </li>
                            <li class="menu-item">
                                <a title="Beverage" href="productlist.html?tag=coldProtective" class="herald-menu-item-title">Cold Resistant Gloves</a>
                            </li>
                            <li class="menu-item">
                                <a title="Citruss" href="productlist.html?tag=antiChemical" class="herald-menu-item-title">Chemical Resistant Gloves</a>
                            </li>
                            <li class="menu-item">
                                <a title="Citruss" href="productlist.html?tag=antiCuttingArm" class="herald-menu-item-title">Cut Resistant Sleeves</a>
                            </li>
                            <li class="menu-item">
                                <a title="Citruss" href="productlist.html?tag=policeUse" class="herald-menu-item-title">Gloves for Police</a>
                            </li>
                            <li class="menu-item">
                                <a title="Citruss" href="productlist.html?tag=pet" class="herald-menu-item-title">Pet Grooming Gloves</a>
                            </li>
                            <li class="menu-item">
                                <a title="Menthol" href="productlist.html?tag=otherType" class="herald-menu-item-title">More Gloves...</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="header-nav">
                    <div class="container-wapper">
                        <ul class="herald-clone-mobile-menu herald-nav main-menu " id="menu-main-menu">
                            <li class="menu-item">
                                <a href="index.html" class="herald-menu-item-title" title="Home">Home</a>
                            </li>

                            <li class="menu-item ">
                                <a href="about.html" class="herald-menu-item-title" title="About">About us</a>
                            </li>


                            <li class="menu-item">
                                <a href="productlist.html?tag=amazon" class="herald-menu-item-title" title="Amazon">Amazon</a>
                            </li>

                            <li class="menu-item">
                                <a href="productlist.html?tag=newProduct" class="herald-menu-item-title" title="New product">New product</a>
                            </li>

                            <!--<li class="menu-item">
                                <a href="index.html" class="herald-menu-item-title" title="Home">Ready to ship</a>
                            </li>-->

                            <li class="menu-item">
                                <a href="contact.html" class="herald-menu-item-title" title="contact">Contact us</a>
                            </li>

                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>
<div class="header-device-mobile">
    <div class="wapper">
        <div class="item mobile-logo">
            <div class="logo">
                <a href="#">
                    <img src="assets/images/logo.png" alt="img" />
                </a>
            </div>
        </div>
        <div class="item item mobile-search-box has-sub">
            <a href="#">
						<span class="icon">
							<i class="fa fa-search" aria-hidden="true"></i>
						</span>
            </a>
            <div class="block-sub">
                <a href="#" class="close">
                    <i class="fa fa-times" aria-hidden="true"></i>
                </a>
                <div class="header-searchform-box">
                    <form class="header-searchform">
                        <div class="searchform-wrap">
                            <input type="text" class="search-input" placeholder="Enter keywords to search..." />
                            <input type="submit" class="submit button" value="Search" />
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="item mobile-settings-box has-sub">
            <a href="#">
						<span class="icon">
							<i class="fa fa-cog" aria-hidden="true"></i>
						</span>
            </a>
            <div class="block-sub">
                <a href="#" class="close">
                    <i class="fa fa-times" aria-hidden="true"></i>
                </a>
                <div class="block-sub-item">
                    <h5 class="block-item-title">Currency</h5>
                    <form class="currency-form herald-language">
                        <ul class="herald-language-wrap">
                            <li class="active">
                                <a href="#">
											<span>
												English (USD)
											</span>
                                </a>
                            </li>
                            <li>
                                <a href="#">
											<span>
												French (EUR)
											</span>
                                </a>
                            </li>
                            <li>
                                <a href="#">
											<span>
												Japanese (JPY)
											</span>
                                </a>
                            </li>
                        </ul>
                    </form>
                </div>
            </div>
        </div>
        <div class="item menu-bar">
            <a class=" mobile-navigation  menu-toggle" href="#">
                <span></span>
                <span></span>
                <span></span>
            </a>
        </div>
    </div>
</div>


<script>


    function login() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/api/user/login.do" ,//url
            data: $('#login-form').serialize(),
            success: function (message) {
                var result = message;
                alert(result.resultMessage);
                if (result.result) {
                    // 刷新页面
                    window.location.reload();
                }
            },
            error : function() {
                alert("注册异常！");
            }
        });
        // 必须返回false，否则表单会自己再做一次提交操作，并且页面跳转
        return false;
    }

    function register() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/api/user/register.do" ,//url
            data: $('#register-form').serialize(),
            success: function (message) {
                var result = message;
                alert(result.resultMessage);
            },
            error : function() {
                alert("注册异常！");
            }
        });
        // 必须返回false，否则表单会自己再做一次提交操作，并且页面跳转
        return false;
    }
</script>
</html>
